﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

namespace HDJ.Framework.Core
{

    public class UIRoot : MonoBehaviour
    {
        public int id;

        public Transform childRoot;
        public Transform fixedRoot;
        public Transform normalRoot;
        public Transform popupRoot;
        public Camera uiCamera;

        private void Awake()
        {
            DontDestroyOnLoad(this);
             UIManager.AddUIRoot(this);
        }
        public  void SetUIParentByUIType(GameObject ui, UIType type)
        {

            if (type == UIType.Fixed)
            {
                ui.transform.SetParent(fixedRoot);
            }
            else if (type == UIType.Normal)
            {
                ui.transform.SetParent(normalRoot);
            }
            else if (type == UIType.PopUp)
            {
                ui.transform.SetParent(popupRoot);
            }

        }

    }
}
